package com.sgxy.service.impl;

import com.sgxy.entity.DeptInf;
import com.sgxy.mapper.DeptInfMapper;
import com.sgxy.service.DeptInfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeptInfServiceImpl implements DeptInfService {

    private final DeptInfMapper deptInfMapper;

    @Autowired
    public DeptInfServiceImpl(DeptInfMapper deptInfMapper) {
        this.deptInfMapper = deptInfMapper;
    }

    @Override
    public int addDeptInf(DeptInf deptInf) {
        int i = deptInfMapper.insertSelective(deptInf);
        return i;
    }

    @Override
    public int deleteDeptInf(List<Integer> id) {
        int i = deptInfMapper.deleteDeptInfById(id);
        return i;
    }

    @Override
    public int updateDeptInf(DeptInf deptInf) {
        int i = deptInfMapper.updateByPrimaryKeySelective(deptInf);
        return i;
    }

    @Override
    public DeptInf queryDeptInf(Integer id) {
        DeptInf deptInf = deptInfMapper.selectByPrimaryKey(id);
        return deptInf;
    }

    @Override
    public List<DeptInf> queryAllDeptInfs(DeptInf deptInf) {
        List<DeptInf> deptInfs = deptInfMapper.queryAllDeptInfs(deptInf);
        return deptInfs;
    }
}
